package com.greenDao.pojo;

import java.util.Date;

import android.widget.EditText;

import com.greenDao.activity.tool.Utils;

public class PojoUtils {

	private PojoUtils() {
		// no instance needed
	}

	public static Movie createMovie(EditText... edits) {

		String title = edits[Utils.NTITLE].getText().toString();
		String director = edits[Utils.NDIRECTOR].getText().toString();
		Integer year = Utils.toInteger(edits[Utils.NYEAR].getText().toString());
		Double rate = Utils.toDouble(edits[Utils.NRATE].getText().toString());

		return PojoUtils.createMovie(title, year, director, rate);
	}

	public static Movie createMovie(String title, Integer year, String director, Double rate) {

		Movie movie = new Movie();
		movie.setTitle(title);
		movie.setYear(year);
		movie.setDirector(director);
		movie.setRate(rate);

		return movie;
	}

	// public static Movie createMovie(String title, Integer year, String
	// director, Double rate) {
	// return new Movie(null, title, year, director, rate);
	// }

	public static Event createEvent(String name, Movie movie, Date date, String comment) {

		Event event = new Event();
		event.setName(name);
		event.setMovieId(movie.getId());
		event.setMovie(movie);
		event.setTime(date);
		event.setComment(comment);

		return event;
	}

	// public static Event createEvent(String name, Movie movie, Date date,
	// String comment) {
	// return new Event(null, name, date, comment, movie.getId());
	// }
}
